package com.wz.dhs.model;


/**
 * @author xyb
 * @Description 全局用户信息
 * @since 17:10 2022/7/14
 */
public class UserContextHolder {

    public static ThreadLocal<UserTokenCache> userToken = new ThreadLocal<>();

    public static UserTokenCache getUserInfo() {
        return userToken.get();
    }

    public static void remove() {
        userToken.remove();
    }

    public static void setUserInfo(UserTokenCache userInfo) {
        userToken.set(userInfo);
    }

    public static Long getUserId(){
        return userToken.get().getUserId();
    }

    public static Integer getIntUserId(){
        return userToken.get().getUserId().intValue();
    }



    public static String getUsername(){
        return userToken.get().getUsername();
    }





}
